#include "../source/server.hpp"

void test1()
{
    Buffer buf1;
    std::string str = "hello";
    buf1.WriteAndMoveIdx(str);

    Buffer buf2;
    buf2.WriteAndMoveIdx(buf1);

    std::string tmp = buf2.ReadAndMoveIdx(buf2.ReadableSize());
    std::cout << tmp << std::endl;
    std::cout << buf1.ReadableSize() << std::endl;
    std::cout << buf2.ReadableSize() << std::endl;

    for(int i = 0; i < 10; i++)
    {
        std::string line = "hello" + std::to_string(i) + '\n';
        buf2.WriteAndMoveIdx(line);
    }
    while(buf2.ReadableSize() > 0)
    {
        std::string line = buf2.GetLineAndMoveIdx();
        std::cout << line << std::endl;
    }
    DLOG("read finish! %d", 666);
}


int main()
{
    test1();
    return 0;
}